<template>
	<view class="y-flex" :style="{'height': height ? _pixelunit(height) : 'auto'}" @tap="handleTap">
		<com-image lazy-load class="y-flex-1" :border-radius="borderRadius" :mode="mode" :src="data.cover"></com-image>
	</view>	
</template>

<script>
	import { pixelunit } from '@/assets/js/util.js'
	export default {
		inject: ['navigate'],
		props: {
			data: {
				type: Object,
				default () {
					return new Object
				}
			},
			options: {
				type: Object,
				default () {
					return new Object
				}
			}
		},
		computed: {
			height () {
				return this.options.height || ''
			},
			mode () {
				return this.options.mode || 'widthFix'
			},
			borderRadius () {
				return this.options.borderRadius
			}
		},
		methods: {
			_pixelunit (size) {
				return pixelunit(size)
			},
			handleTap (e) {
				this.navigate(this.data.url)
			}
		}
	}
</script>

<style>
</style>